/**
 * 获奖名单单体
 */
class EndLessWinItem extends eui.ItemRenderer{
    private lb_win:eui.Label;
    private img_mask:eui.Image;
    private img_head:eui.Image;
    private lb_name:eui.Label;
    private lb_money:eui.Label;
    private lb_number:eui.Label;

    private oldData;
    constructor()
    {
        super();
        this.skinName = 'EndLessWinItemView';
        this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoveToStageHandler, this);
    }

    private onRemoveToStageHandler(e:egret.Event){
		this.clear();
	}

    public initUI()
    {
        if(this.data)
        {
            this.img_head.source = this.data.avatar_url;
            this.img_head.width = this.img_head.height = 68;
            this.img_head.mask = this.img_mask;
            this.lb_name.text = this.data.nick_name;
            this.lb_number.text = this.data.phone_number+'';
        }
    }

    public dataChanged()
    {
        if(this.data == this.oldData)return;
        this.oldData = this.data;
        this.initUI();
    }

    public clear()
    {
        this.data = null;
        this.oldData = null;
        this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoveToStageHandler,this);
    }
}

window['EndLessWinItem'] = EndLessWinItem;